menuitem: force odd height if we're not using wide separators
authorCosimo Cecchi <cosimoc@gnome.org>
Thu, 15 Dec 2011 14:54:59 +0000 (15:54 +0100)
committerCosimo Cecchi <cosimoc@gnome.org>
Thu, 15 Dec 2011 17:52:30 +0000 (18:52 +0100)
So that the 1px line can receive the same amount of space above and
below.

https://bugzilla.gnome.org/show_bug.cgi?id=666242

gtk/gtkmenuitem.c

index 46491474a43eed79e37bde35d15411d269e7df50..e9c2bea56c74124578e29e90cb8d7acc5713efdb 100644 (file)
@@ -945,6 +945,16 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
           min_height += separator_height;
           nat_height += separator_height;
         }
+      else
+        {
+          /* force odd, so that we can have the same space above and
+           * below the line.
+           */
+          if (min_height % 2 == 0)
+            min_height += 1;
+          if (nat_height % 2 == 0)
+            nat_height += 1;
+        }
     }
 
   accel_width = 0;
@@ -1071,6 +1081,16 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
           min_height += separator_height;
           nat_height += separator_height;
         }
+      else
+        {
+          /* force odd, so that we can have the same space above and
+           * below the line.
+           */
+          if (min_height % 2 == 0)
+            min_height += 1;
+          if (nat_height % 2 == 0)
+            nat_height += 1;
+        }
     }
 
   if (minimum_size)